package kvo

import (
	"database/sql/driver"
	"encoding/json"
)

type Vector []float32

func (vct *Vector) Scan(value interface{}) (err error) {
	return json.Unmarshal(value.([]byte), vct)
}
func (vct Vector) Value() (driver.Value, error) {
	return json.Marshal(vct)
}

func NewMatrix(data [][]float32) *Matrix {
	v := Matrix(data)
	return &v
}

// 矩阵
type Matrix [][]float32

func (vct *Matrix) Scan(value interface{}) (err error) {
	return json.Unmarshal(value.([]byte), vct)
}
func (vct Matrix) Value() (driver.Value, error) {
	return json.Marshal(vct)
}
